package com.baikeyang.commons;

import java.text.MessageFormat;


public class Constants {

    // 用户信息在session中存储时，对应的key值
    public static final String SESSION_USER_KEY = "youth_user_v_admin";

    /**
     * 盐大小
     */
    public static int SALT_SIZE = 8;

    /**
     * 散列算法迭代次数
     */
    public static int SHA_ITERATION_NUM = 1;

    /**
     * 加密算法
     */
    public static final String SHA1 = "SHA-1";
    public static final String MD5 = "MD5";

    public static final int SALT_START_INDEX = 0;
    public static final int SALT_END_INDEX = 16;


    public static final class EXECUTEINFO{
        public static final String 成功 = "SUCCESS";
        public static final String 失败 = "FAIL";
        public static final String 异常 = "ERROR";

        public static final String getInfo(String infoType, String info){
            String template = "{0}:{1}";
            return MessageFormat.format(template, infoType, info);
        }
    }


    /**
     * @Title Constants.java
     * @Description TODO 故障码
     * 			故障码规则：
     * 			3+接口序号+ code码
     * 			接口序号不够2位，则用0补齐；
     * 			code码规则：三位数，从100开始；
     * 							1XX 为限制类错误
     * 							2XX 为调用方错误
     * 							3XX 为平台错误
     * 							4XX 为调用误码
     * 			如接口序号2，code码位1，则该故障码为302101
     * @See
     * @ComputerUser lenovo
     * @Time 2016年11月30日 上午10:50:23
     * @Version v1.0.0
     */
    public static final class EXECUTECODE{
        public static final int CODE_100 = 100;
        public static final int CODE_101 = 101;
        public static final int CODE_102 = 102;

        public static final int CODE_200 = 200;
        public static final int CODE_400 = 400;
        public static final int CODE_404 = 404;
        public static final int CODE_500 = 500;
    }

    public static final class EXECUTESTATUS{
        public static final boolean 成功 = true;
        public static final boolean 失败 = false;
    }

}
